package com.jdy.haoduoaiteacher.task;//package com.jdy.haoduoaiteacher.task;
//
//import java.io.InputStream;
//import java.net.HttpURLConnection;
//import java.net.URL;
//
//import android.graphics.Bitmap;
//import android.graphics.BitmapFactory;
//import android.os.AsyncTask;
//
//import com.jdy.haoduoaiteacher.util.ImageUtils;
//import com.jdy.haoduoaiteacher.util.LeXiaoXiaoBanLog;
//
///**
// * Get image from url and set it to the ImageView passed by constructor.
// * 
// * @author zp @ 2015-5-25 下午4:51:53
// */
//public class GetImageTask extends AsyncTask<String, Void, Bitmap> {
//
//  public static final String TAG = "GetImageTask";
//
//  private final int mPosition;
//
//  private final BaseViewHolder mHolder;
//
//  public GetImageTask(int position, BaseViewHolder viewHolder) {
//
//    // this.mPosition = position;
//
//    this.mHolder = viewHolder;
//
//    this.mPosition = (Integer) mHolder.Thumbnail.getTag();
//  }
//
//  @Override
//  protected Bitmap doInBackground(String... urls) {
//    String urldisplay = urls[0];
//    Bitmap resultImage = null;
//    try {
//
//      URL url = new URL(urldisplay);
//
//      HttpURLConnection urlConnection = (HttpURLConnection) url
//          .openConnection();
//
//      urlConnection.setRequestMethod("GET");
//      // urlConnection.setDoOutput(true);
//
//      urlConnection.connect();
//
//      InputStream in = urlConnection.getInputStream();
//
//      // InputStream in = new java.net.URL(urldisplay).openStream();
//      resultImage = BitmapFactory.decodeStream(in);
//
//      resultImage = ImageUtils.getRoundedCornerBitmap(resultImage, 13);
//    } catch (Exception e) {
//      LeXiaoXiaoBanLog.e(TAG, e.getMessage());
//      e.printStackTrace();
//    }
//
//    return resultImage;
//  }
//
//  @Override
//  protected void onPostExecute(Bitmap result) {
//    if ((Integer) mHolder.Thumbnail.getTag() == mPosition && result != null) {
//      // mHolder.Thumbnail.setImageBitmap(null);
//      mHolder.Thumbnail.setImageBitmap(result);
//    }
//  }
// }